
import tkinter as tk
from tkinter import *
from tkinter.filedialog import (askopenfilename)

def selectPath():
    # 选择文件path_接收文件地址
    path_ = tk.filedialog.askopenfilename()

    # 通过replace函数替换绝对文件地址中的/来使文件可被程序读取
    # 注意：\\转义后为\，所以\\\\转义后为\\
    # path_ = path_.replace("/", "\\\\")
    # path设置path_的值
    # path.set(path_)

if __name__ == '__main__':

    # https://www.cnblogs.com/shwee/p/9427975.html

    # 选择文件并返回文件全路径
    # askopenfilename1 = askopenfilename()
    # print(askopenfilename1)
    window = tk.Tk()
    window.title('铁头辅助器')
    window.geometry('500x300')

    # tk.Label(window, text="目标路径:").grid(row=0, column=0)
    # 输入框绑定变量path
    # path = tk.StringVar()
    # tk.Entry(window, textvariable=path).place(x=10, y=10)
    # tk.Button(window, text="选择启动路径", command=selectPath).place(x=10, y=30)
    # frame = tk.Frame(window)
    # frame.pack()
    # sign = tk.Frame(frame)
    # sign.pack()
    # tk.Label(sign, text='登录', bg='green').pack()
    # msg = tk.Frame(window)
    # msg.pack()
    # tk.Label(msg, text='日志', bg='red').pack()
    # tool = tk.Frame(window)
    # tool.pack()
    # tk.Label(tool, text='工具', bg='green').pack()

    lf1 = tk.Frame(window)
    lf1.pack(side=LEFT, fill=X, anchor=NW, padx=5, pady=5)

    lf1_0 = tk.Frame(lf1)
    lf1_0.pack(side=TOP, fill=Y)

    lf1_1 = tk.LabelFrame(lf1_0, text="启动")
    lf1_1.pack(side=LEFT, anchor=NW, fill=Y, padx=5, pady=5)

    lf1_2 = tk.LabelFrame(lf1_0, text="功能")
    lf1_2.pack(side=RIGHT, anchor=NW, fill=Y, padx=5, pady=5)

    lf1_3 = tk.Frame(lf1)
    lf1_3.pack(side=TOP, fill=Y, padx=5, pady=5)

    lf2 = tk.Frame(window)
    lf2.pack(side=LEFT, fill=X, anchor=NE, padx=5, pady=5)

    lf2_0 = tk.LabelFrame(lf2, text="测试")
    lf2_0.pack(side=TOP, fill=Y, padx=5, pady=5)

    window.update()
    window.resizable(False, False)
    window.mainloop()